package org.smarthings.things.automation.test.mock;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.smarthings.things.management.metadata.provider.ThingEventMetadataProvider;

public class MockedThingEventMetadataProvider implements ThingEventMetadataProvider {

	private Map<String, Map<String, Object>> topics;
	
	public MockedThingEventMetadataProvider() {
		
		Map<String, Object> description = new HashMap<String, Object>(3);
		description.put("capability", String.class);
		description.put("thing", String.class);
		description.put("data", Integer.class);
		description.put("timestamp", Long.class);
		
		this.topics = new HashMap<String, Map<String, Object>>(3);
		this.topics.put("ThingCapabilityEvent", description);
	}

	public List<String> getThingEventTopics() {
		return new ArrayList<String>(topics.keySet());
	}

	public Map<String, Object> getThingEventDescription(String topic) {
		return topics.get(topic);
	}

	public void addTopic(String topic, Map<String, Object> description) {
		topics.put(topic, description);
	}

	public void removeTopic(String topic) {
		topics.remove(topic);
	}

}
